<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>

<body>

</body>
<script>
    const nums = [10, 20, 30, 50,"",""]
    const nn =[]
    for (let i = nums.length-1; i >=0 ; i--) {
        nn.push(nums[i])
    }
    console.log(nn)
   const  nn1 = nn.filter(x=>x!="");
    console.log(nn1)

    console.log(nums.length)
    // 对数组中所有的内容进行汇总
    let newNum = nums.reduce(function (preValue, currentValue) {
        return preValue + currentValue
    }, 0)
    //      起始值是0， prevalue 是遍历数组之后操作的返回值， currentValue是当前被迭代的元素
    //            preValue  currentValue
    //              0           10
    //              10          20
    //              20          30
    //              30          50

    console.log(newNum)
</script>

</html>
